import 'package:flutter/material.dart';
import 'package:ad_x_sdk_example/com/qlslylq/flutterdesign/scene/BaseScene.dart';

import 'BannerAdTestMainScene.dart';
import 'InterstitialAdTestMainScene.dart';
import 'MainScene.dart';
import 'RewardAdTestMainScene.dart';
import 'SplashAdTestMainScene.dart';

/*
 * 广告测试示例主页 <br/>
 * 需要传入的键：<br/>
 * 传入的值类型： <br/>
 * 传入的值含义：<br/>
 * 是否必传 ：
 */
class ExampleScene extends BaseScene {
  State<StatefulWidget> createState() {
    return new ExampleSceneState();
  }
}

/*
 * 页面功能 <br/>
 */
class ExampleSceneState extends BaseSceneState {
  ExampleSceneState() {
    title = 'AdDesign';
    setRightButtonFromText('支持');
    leading = new Container(width: 0, height: 0);
  }

  Widget build(BuildContext context) {
    var listTileHeight = 33.5;
    var listTileMargin = EdgeInsets.fromLTRB(50, 0, 50, 0);

    return buildBody(
        context,
        new Column(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            crossAxisAlignment: CrossAxisAlignment.center,
            // scrollDirection: Axis.vertical,
            // padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
            children: <Widget>[
              new Container(
                width: MediaQuery.of(context).size.width,
                height: listTileHeight,
                margin: listTileMargin,
                child: new RaisedButton(
                  onPressed: () {
                    switchingScene(new SplashAdTestMainScene());
                  },
                  child: new Text('开屏广告测试'),
                  color: Theme.of(context).buttonColor,
                  shape: Border.all(
                      color: Colors.red, style: BorderStyle.solid, width: 1),
                ),
              ),
              new Container(
                width: MediaQuery.of(context).size.width,
                height: listTileHeight,
                margin: listTileMargin,
                child: new RaisedButton(
                  onPressed: () {
                    switchingScene(new RewardAdTestMainScene());
                  },
                  child: new Text('激励广告测试'),
                  color: Theme.of(context).buttonColor,
                  shape: Border.all(
                      color: Colors.green, style: BorderStyle.solid, width: 1),
                ),
              ),
              new Container(
                width: MediaQuery.of(context).size.width,
                height: listTileHeight,
                margin: listTileMargin,
                child: new RaisedButton(
                  onPressed: () {
                    switchingScene(new InterstitialAdTestMainScene());
                  },
                  child: new Text('插屏广告测试'),
                  color: Theme.of(context).buttonColor,
                  shape: Border.all(
                      color: Colors.blue, style: BorderStyle.solid, width: 1),
                ),
              ),
              new Container(
                width: MediaQuery.of(context).size.width,
                height: listTileHeight,
                margin: listTileMargin,
                child: new RaisedButton(
                  onPressed: () {
                    switchingScene(new BannerAdTestMainScene());
                  },
                  child: new Text('横幅广告测试'),
                  color: Theme.of(context).buttonColor,
                  shape: Border.all(
                      color: Colors.yellow, style: BorderStyle.solid, width: 1),
                ),
              ),
            ]));
  }

  void onClick(Widget widget) {
    if (widget.key == key_btn_right) {
      switchingScene(new MainScene());
    }
  }
}
